var express = require('express');
var session = require('express-session');
var  admin = require('./routers/admin');
var  index = require('./routers/index');
var  api = require('./routers/api');
var app = new express();
app.use(session({
    secret:'keyboard cat',
    resave: false,
    saveUninitialized:true,
    cookie:{
      maxAge:1000*60*30,
    },
    rolling:true,
}));

// 设置模板
app.set('view engine','ejs');

//配置public目录为我们的静态资源目录
app.use(express.static('public'));
// 路由分发
 app.use('/',index);
 app.use('/admin',admin);
 app.use('/api',api);

 console.log('server start:  http://127.0.0.1:8009');
//监听端口
app.listen(8009,'127.0.0.1');


